package com.coder.algorithm.leetcode

/**
 * [561. 数组拆分 I](https://leetcode-cn.com/problems/array-partition-i/)
 *
 * @author yuhus
 * @date: 2022/3/28
 */
object l_0561 {
    fun arrayPairSum(nums: IntArray): Int {
        val sorted = nums.sorted()
        var result = 0
        for (i in sorted.indices step 2) {
            result += sorted[i]
        }
        return result
    }
}